<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>图书借阅统计</title>
    <meta name="decorator" content="default"/>
    <script src="${ctxStatic}/lodop/LodopFuncs.js" type="text/javascript"></script>
    <script>
        function search() {
            $("#searchForm").attr("action", "${ctx}/statistics/book").submit();
        }

        var LODOP; //声明为全局变量
        function myPreview1(){
            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));
            var strBodyStyle="<head>"+$("head").html()+"</head>";
            var strFormHtml=strBodyStyle+"<body>"+$("#contentTable").html()+"</body>";
            LODOP.PRINT_INIT("图书借阅统计");
            LODOP.ADD_PRINT_TEXT(50,50,260,39, "日期："+$("#begin").val()+"--"+$("#end").val());
            LODOP.ADD_PRINT_HTM(88, 50, 300, 900, strFormHtml);
            LODOP.PREVIEW();
        }
    </script>
</head>
<body>
<form:form id="searchForm" modelAttribute="bkBookinfo" action="${ctx}/statistics/borrow" method="post" class="breadcrumb form-search">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <ul class="ul-form">
        <li>
            <label style="width: 80px;">按：</label>
            <select name="type" class="input-medium" style="width: 100px;">
                <option value="type" ${type eq ''?'type':''}>图书分类</option>
                <option value="level" ${type eq 'level'?'selected':''}>借阅等级</option>
                <option value="other" ${type eq 'other'?'selected':''}>流通类型</option>
            </select>进行统计
            <label style="width: 90px;">统计范围，</label>
            从<input id="begin"
                    name="begin"
                    class="input-medium Wdate"
                    readonly="readonly"
                    maxlength="20"
                    type="text"
                    style="width: 100px"
                    value="${begin}"
                    onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});">
            至
            <input id="end"
                   name="end"
                   class="input-medium Wdate"
                   readonly="readonly"
                   maxlength="20"
                   type="text"
                   style="width: 100px"
                   value="${end}"
                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"> 统计读者借阅次数
        </li>
        <li style="margin-left: 20px;">
            <a href="javascript:search();" class="btn">统计</a>
            <a href="javascript:myPreview1();" class="btn">打印</a>
        </li>
    </ul>

</form:form>
<sys:message content="${message}"/>
<div id="contentTable">
    <table class="table table-striped table-bordered table-condensed" style="width: 500px;">
        <thead>
        <tr>
            <th>图书分类</th>
            <th>借阅册数</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${statistics}" var="info" varStatus="status">
            <tr>
                <td>${info.classcode}|${info.className}</td>
                <td>${info.count}</td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
<div class="printArea">
    <object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=1 height=1>
        <param name="Caption" value="内嵌显示区域">
        <param name="Border" value="1">
        <param name="Color" value="#C0C0C0">
        <embed id="LODOP_EM" TYPE="application/x-print-lodop" width=1 height=1 PLUGINSPAGE="install_lodop.exe">
    </object>
</div>
</body>
</html>